// store.js
import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.use(Vuex)
const state={
  login:false
}
const mutations={
  change(state,o){
      state.login=o.msg
  }
}
const actions= {
    saveForm (context) {
      axios.get('api/user', {
        params: {
          name: 'crism',
          call:'17188802909'
      },
        headers: {'X-Requested-With': 'XMLHttpRequest'},
      })
      .then(function (response) {
        console.log(response.data);
        context.commit('change',response.data)
      })
      .catch(function (error) {
        console.log(error);
      });
    }
  }

  export default new Vuex.Store({
    actions,state,mutations
})